package org.jeecg.modules.lab.util;

import java.lang.reflect.Field;
import java.util.Map;

public class ObjectToMapUtil {

    public static void dataToExcel(Object obj, Map map){
        Class<?> aClass = obj.getClass();
        for (Field field:aClass.getDeclaredFields()) {
            field.setAccessible(true);
            try {
                if (field.get(obj) == null || "".equals(field.get(obj))){
                    map.put(field.getName(),"--");
                }else{
                    map.put(field.getName(),field.get(obj));
                }
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }

    }
}
